/**基本物件派生类:字符
 * @date： 2011 4 10
 * @author: zzy
 **/
package cn.edu.dlut.WingGame.Object;

import android.graphics.Rect;
import cn.edu.dlut.WingGame.BaseType.WingColor;
import cn.edu.dlut.WingGame.Graphic.GLFont;

public class WingFont extends WingObject {
	private float x = 0;
	private float y = 0;
	private Rect rect = new Rect();
	private String str = new String();

	private boolean isRect = false;
	private GLFont ObjectFont = new GLFont();

	public WingFont() {
	}

	public WingFont(int fontSize, WingColor fontColor) {
		ObjectFont.creatFont(fontSize, fontColor);
	}

	public WingFont(String fontname, int fontsize, WingColor fontcolor,
			boolean isbold, boolean isitalic) {
		ObjectFont.creatFont(fontname, fontsize, fontcolor, isbold, isitalic);
	}

	public WingFont(String ttfPath, int fontsize, WingColor fontcolor) {
		ObjectFont.creatFont(ttfPath, fontsize, fontcolor);
	}

	public void setTextPos(float x, float y) {
		this.x = x;
		this.y = y;
	}

	public void setTextRect(Rect rect) {
		this.rect = rect;
		isRect = true;
	}

	public void setTextStr(String str) {
		this.str = str;
	}

	public void drawTextStr() {
		ObjectFont.drawText(this.x, this.y, this.str);
	}

	public void drawTextRect() {
		ObjectFont.drawText(this.rect, this.str);
	}

	@Override
	public void render() {
		// TODO Auto-generated method stub
		if (isRect) {
			drawTextRect();
		} else
			drawTextStr();
	}

	@Override
	public void update() {
		// TODO Auto-generated method stub

	}

}